﻿using MQ.Core.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MQ.Core.Db
{
    public static class DbContextExtensions
    {
        public static IQueryable<T> ToPageList<T>(this IQueryable<T> query,Pagination pagination)
        {
            pagination.total = query.Count();
            return query.Skip((pagination.index - 1) * pagination.size).Take(pagination.size);
        }
    }
}
